<#assign module="insurance"/>

<@override name="header">
<link rel="stylesheet" href="${ctx}/assets/css/datetimepicker.css">
</@override>

<@override name="body">

<div class="row margin-top">
	<div class="col-xs-12">
		<form class="form-inline" role="form">
			<select class="form-control" id="type" name="type">
				<option value="">--所有保险类型--</option>
  				<option value="djx" <#if type?? && type=="djx">selected="selected"</#if>>代驾险</option>
  				<option value="ywx" <#if type?? && type=="ywx">selected="selected"</#if>>意外险</option>
  			</select>
		    
		    <div class="input-group">
				<input id="startTime" name="startTime" type="text" class="form-control" placeholder="开始时间" value="${startTime?if_exists}" />
			</div>
			
		  	<div class="form-group">
		  		<input id="endTime" name="endTime" type="text" class="form-control" placeholder="结束时间" value="${endTime?if_exists}" />
		    </div>
		    
		  	<button id="search_button" type="submit" class="btn btn-primary"><i class="glyphicon glyphicon-search"></i>&nbsp;搜索</button>
		  	
		  	<button id="export_button" type="button" class="btn btn-primary col-sm-offset-0"><i class="glyphicon glyphicon-save"></i>&nbsp;导出</button>
		  	
		</form>
	</div>
</div>

<div class="row margin-top">
    <div class="col-xs-12">
        <div class="panel panel-primary">
            <div class="table-responsive">
                <table class="table table-hover table-striped">
                    <thead>
                    <tr style="font-size:14px;">
                        <th>投保金额</th>
                        <th>类型</th>
                        <th>订单号</th>
                        <th>时间</th>
                    </tr>
                    </thead>
                    <#if (page.content)?? >
                        <tbody>
                            <#list page.content as data>
	                            <tr>
	                                <td>${data.money}</td>
	                                <td>
	                                	<#if data.insuranceType=="djx">
	                                		代驾险
	                                	<#elseif data.insuranceType=="ywx">
	                                		意外险
	                                	</#if>
	                                </td>
	                                <td>${data.orderNo}</td>
	                                <td>${data.created?datetime}</td>
	                            </tr>
                            </#list>
                        </tbody>
                    </#if>
                </table>

                <#if page.totalElements??>
                    <ul class="pagination pull-right pagination-sm">
                        <li><a>共 ${page.totalElements} 条数据</a></li>
                        <@pg.pager items=page.totalElements?number maxPageItems=20 export="currentPageNumber=pageNumber" url="${ctx}/insurances/listinsurance">
                            <@pg.param name="type" value="${type?if_exists}"/>
							<@pg.param name="startTime" value="${startTime?if_exists}"/>
							<@pg.param name="endTime" value="${endTime?if_exists}"/>
                            <@pg.index>
                                <@pg.first>
                                    <li><a href="${pageUrl}">&laquo;</a></li>
                                </@pg.first>
                                <@pg.prev>
                                    <li><a href="${pageUrl}">&lsaquo;</a></li>
                                </@pg.prev>
                                <@pg.pages>
                                    <#if  currentPageNumber == pageNumber >
                                        <li class="active"><a href="#">${pageNumber}</a></li>
                                    <#else>
                                        <li><a href="${pageUrl}">${pageNumber}</a></li>
                                    </#if>
                                </@pg.pages>
                                <@pg.next>
                                    <li><a href="${pageUrl}">&rsaquo;</a></li>
                                </@pg.next>
                                <@pg.last>
                                    <li><a href="${pageUrl}">&raquo;</a></li>
                                </@pg.last>
                            </@pg.index>
                        </@pg.pager>
                    </ul>
                </#if>
            </div>
        </div>
    </div>
</div>

</@override>

<@override name="footer">
<script type="text/javascript">
    $(function () {
			$("#startTime").datetimepicker({
		        format: "yyyy-mm-dd HH:ii",
		        language: 'zh-CN',
		        showMeridian: true,
		        autoclose: true,
		        todayBtn: true
		    });
			$("#endTime").datetimepicker({
				format: "yyyy-mm-dd HH:ii",
		        language: 'zh-CN',
		        showMeridian: true,
		        autoclose: true,
		        todayBtn: true
		    });
		    
		    $("#export_button").click(function(){
		    	window.location="${ctx}/insurances/exportInsurance?"+"type="+$("#type").val()+"&startTime="+$("#startTime").val()+"&endTime="+$("#endTime").val();
		    });
    });
</script>
</@override>

<@extends name="../layout.ftl"/>